package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;

@Setter@Getter@ToString
public class Chat extends BaseDomain{
    public static final Integer STATE_UNREAD = 0;//未读
    public static final Integer STATE_READ = 1;//已读

    private User sendUser;//发送人

    private User receiveUser;//接收人

    private String content;//内容

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date sendTime;//发送时间

    private Integer state = STATE_UNREAD;//状态 默认未读

    private boolean isMine = false;//发送人是自己

    public String getSendTimeName(){
        return DateUtil.formatDate(sendTime);
    }
}